﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Surpass.Model.WorkFlow;
using Surpass.Repository.IRepository;
using Surpass.Repository.Repository;
using System.Threading.Tasks;

namespace Surpass.Admin.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class LeaveController : ControllerBase
    {
        private readonly ILeaveRepository _leaveRepository;
        public LeaveController(ILeaveRepository leaveRepository)
        {
            _leaveRepository = leaveRepository;
        }

        [HttpPost]
        public async Task<IActionResult> LeaveSave(LeaveRequest leaveRequest, long operatorId, string operatorName)
        {
            return Ok(await _leaveRepository.LeaveSave(leaveRequest, operatorId, operatorName));
        }
    }
}
